<template>
  <div>
    <div class="set-item">
      <div class="tit">主题文本</div>
      <div class="it">
        <!-- <BaseTextareaFull @inputValue="onInputValue" :value="themeText"/> -->
        <RichEditorInline class="r-editor ck-content" :value="themeText" @inputValue="onInputValue"/>
      </div>
    </div>
    <div class="set-item">
      <div class="tit">主题结束时间</div>
      <div class="it">
        <DatePicker ref="vDatePicker" @panel-change="updateBeforeTime" @confirm="onConfirm" v-model="datetime" type="datetime" format="YYYY-MM-DD HH:mm:ss" :minute-step=10 confirm :not-before="notBefore" ></DatePicker>
      </div>
    </div>
    <ColorSet @change="onChangeColor" :c="currActiveItem.color" title="字体颜色"/>
    <div class="set-item">
      <div class="tit">字体大小</div>
      <div class="it"><input type="number" :value="currActiveItem.fontSize" @input="onChangeFontSize($event.target.value)"></div>
    </div>
  </div>
</template>

<script>
import dataApi from '@/view/data-api-edit'
// import BaseTextareaFull from '@/view/comm/BaseTextareaFull'
import DatePicker from 'vue2-datepicker'
import ColorSet from '@/view/SetItems/ColorSet'
import RichEditorInline from '@/view/comm/RichEditorInline'
export default {
  components: {
    DatePicker,
    // BaseTextareaFull,
    RichEditorInline,
    ColorSet
  },
  data () {
    return {
      themeText: '',
      datetime: '',
      notBefore: ''
    }
  },
  computed: {
    currActiveItem () {
      return dataApi.currActiveItem
    }
  },
  created () {
    this.themeText = dataApi.currActiveItem.themeText
    this.datetime = dataApi.currActiveItem.startDate
  },
  methods: {
    updateBeforeTime () {
      this.notBefore = new Date()
    },
    onConfirm () {
      dataApi.currActiveItem.startDate = this.datetime
    },
    onInputValue (v) {
      dataApi.currActiveItem.themeText = v
    },
    onChangeColor (v) {
      dataApi.currActiveItem.color = v
    },
    onChangeFontSize (v) {
      dataApi.currActiveItem.fontSize = v
    }
  }
}
</script>

<style scoped>
.r-editor {
  position: relative;
  background-color: #fff;
  font-size: 32px;
}
.del-ico {
  width: 20px;
  height: 20px;
  margin-right: 4px;
  color: #f52f2f;
}
.add-ico {
  width: 20px;
  height: 20px;
  margin-right: 4px;
  color: #00b7ee;
  vertical-align: -5px;
}
.v-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}
.v-item {
  white-space: nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.del {
      vertical-align: -5px;
}
.n {
  vertical-align: middle;
}
</style>
